package com.example.demo.dao;

import com.example.demo.entity.Goods;
import com.example.demo.entity.Order;
import com.example.demo.entity.Shop;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ShopDAO {
    public List<Shop> findShops();

    public Shop findShop(Goods goods);

    List<Shop> listShopBySearchMsg(@Param("searchMsg") String searchMsg,@Param("start") int start);

    int listShopBySearchMsgTotal(@Param("searchMsg") String searchMsg);

    @Update("update shop set shop_name=#{shop_name}," +
            "shop_src = #{shop_src}," +
            "shop_address = #{shop_address}" +
            "where shop_id = #{shop_id}")
    void editShop(Shop shop);

    @Delete("delete from shop where shop_id = #{id}")
    void deleteShop(@Param("id") int id);

    @Insert("insert into shop (shop_name,shop_src) values(#{shop_name},#{shop_src})")
    void addShop(Shop shop);
}
